from django.db import models

# Create your models here.
#项目信息
class Egame(models.Model):
    objects = models.Manager()
    id = models.AutoField(verbose_name='游戏id',primary_key=True)
    introduction = models.TextField(verbose_name='简介',null=True,blank=True)
    path = models.TextField(verbose_name='路径',null=True,blank=True)
    name = models.CharField(verbose_name='游戏名称',max_length=255,null=True,blank=True)
    create_time = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    update_time = models.DateTimeField(verbose_name='更新时间',auto_now=True)
    #序列化函数str  在Python2中用__unicode__代替__str__
    def __str__(self):
        return self.name
    class Meta:
        #别名
        verbose_name = '游戏信息'
        #更改复数显示方式
        verbose_name_plural = "游戏信息"

#游戏角色
class Roleinfo(models.Model):
    objects = models.Manager()
    id = models.AutoField(verbose_name='角色id',primary_key=True)
    game_id = models.IntegerField(verbose_name='游戏id',null=True,blank=True)
    name = models.CharField(verbose_name='姓名',max_length=255,null=True,blank=True)
    en_name = models.CharField(verbose_name='英文简写',max_length=255,null=True,blank=True)
    img = models.CharField(verbose_name='图片',max_length=255,null=True,blank=True)
    introduction = models.TextField(verbose_name='简介',null=True,blank=True)
    relationship = models.CharField(verbose_name='与主角关系',max_length=255,null=True,blank=True)
    age = models.IntegerField(verbose_name='年龄',null=True,blank=True)
    gender = models.CharField(verbose_name='性别',max_length=5,null=True,blank=True)
    create_time = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    update_time = models.DateTimeField(verbose_name='更新时间',auto_now=True)
    def __str__(self):
        return self.name
    class Meta:
        #别名
        verbose_name = '角色'
        #更改复数显示方式
        verbose_name_plural = "角色"

#游戏对话、旁白、图片与视频
class GameInfo(models.Model):
    objects = models.Manager()
    id = models.AutoField(verbose_name='对话id',primary_key=True)
    game_id = models.IntegerField(verbose_name='游戏id',null=True,blank=True)
    role_id = models.IntegerField(verbose_name='角色id',null=True,blank=True)
    img = models.CharField(verbose_name='游戏图片',max_length=255,null=True,blank=True)
    video = models.CharField(verbose_name='游戏视频',max_length=255,null=True,blank=True)
    content = models.TextField(verbose_name='游戏对话、旁白',null=True,blank=True)
    path = models.CharField(verbose_name='修改的对话文本地址',max_length=255,null=True,blank=True)
    create_time = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    update_time = models.DateTimeField(verbose_name='更新时间',auto_now=True)
    def __str__(self):
        return self.path
    class Meta:
        #别名
        verbose_name = '文本'
        #更改复数显示方式
        verbose_name_plural = "文本"

#待组合事件表
class Zuhe(models.Model):
    objects = models.Manager()
    id = models.AutoField(verbose_name='组合id',primary_key=True)
    game_id = models.IntegerField(verbose_name='游戏id',null=True,blank=True)
    name = models.CharField(verbose_name='名称',max_length=255,null=True,blank=True)
    en_name = models.CharField(verbose_name='英文简写',max_length=255,null=True,blank=True)
    introduction = models.TextField(verbose_name='简介',null=True,blank=True)
    create_time = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    update_time = models.DateTimeField(verbose_name='更新时间',auto_now=True)
    def __str__(self):
        return self.name
    class Meta:
        #别名
        verbose_name = '待组合事件'
        #更改复数显示方式
        verbose_name_plural = "待组合事件"

#组合事件表
class RoleEvent(models.Model):
    objects = models.Manager()
    id = models.AutoField(verbose_name='事件id',primary_key=True)
    game_id = models.IntegerField(verbose_name='游戏id',null=True,blank=True)
    role_id = models.IntegerField(verbose_name='角色id',null=True,blank=True)
    name = models.CharField(verbose_name='事件名称',max_length=255,null=True,blank=True)
    en_name = models.CharField(verbose_name='英文简写',max_length=255,null=True,blank=True)
    introduction = models.TextField(verbose_name='简介',null=True,blank=True)
    trigger = models.CharField(verbose_name='触发条件',max_length=255,null=True,blank=True)
    spend_time = models.CharField(verbose_name='花费时间',max_length=255,null=True,blank=True)
    create_time = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    update_time = models.DateTimeField(verbose_name='更新时间',auto_now=True)
    def __str__(self):
        return self.name
    class Meta:
        #别名
        verbose_name = '事件'
        #更改复数显示方式
        verbose_name_plural = "事件"

